let http = require('http');
let fs = require('fs');
let mime = require('mime');

http.createServer((req,res)=>{
    let url = new URL(req.url,'http://localhost:8887');

    if(url.pathname=='/css'){
        res.writeHead(200,{'Content-Type':`${mime.getType('css')};charset=utf-8`});
        res.write(fs.readFileSync(`${__dirname}/demo.css`));
    }
    res.end();
}).listen(8887,()=>console.log('server start'));